﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Index2.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<App.Views.ViewModels.UCServicesItemListViewModel>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
丧葬物品销售服务
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        var id = 'SaleNO';
        var ctrlName = 'GoodsSaleService';
        function Crud2(id, ctrlName) {
            Crud.call(this, id, ctrlName);
            this.Create = function () {
                url = '../' + ctrlName + '/Create';
                this.url = url;
                $('#dlg').dialog({                    
                    onBeforeOpen: function () {
                        $('#itemList').load(url);
                    }
                });
                $('#dlg').dialog('open').dialog('setTitle', '新增');
                $('#fm').form('clear');
                var curTime = new Date().Format('yyyy-MM-dd hh:mm:ss');
                $('#fm').form('load', { 'SaleDate': curTime});
            };
            this.Edit = function () {
                var row = $('#dg').datagrid('getSelected');
                if (row) {
                    url = '../' + ctrlName + '/Edit?id=' + row[id] + "&s=" + (new Date()).getTime();
                    url = encodeURI(url);
                    this.url = url;
                    $('#dlg').dialog({
                        onBeforeOpen: function () {
                            $('#itemList').load(url);
                        }
                    });
                    $('#dlg').dialog('open').dialog('setTitle', '修改');
                    row['SaleDate'] = JsonToDateString(row['SaleDate'], 'yyyy-MM-dd hh:mm:ss');
                    $('#fm').form('load', row);
                } else {
                    $.messager.alert("提示", "请选择一条记录进行编辑!");
                }
            };
        }

        var crud = new Crud2(id, ctrlName);
        $(function () {
            $('#dg').datagrid({
                title: '丧葬物品销售列表',
                iconCls: 'icon-save',
                url: '../' + ctrlName + '/List',
                sortName: id,
                sortOrder: 'asc',
                remoteSort: false,
                idField: id,
                frozenColumns: [[
	                { field: 'ck', checkbox: true },
	                { title: '编号', field: id, width: 80, sortable: true }
				]],
                columns: [[
                        { field: 'ServiceNo', title: '服务编号', width: 100 },                        
                        { field: 'CustomerName', title: '顾客姓名', width: 100 },
                        { field: 'ContactPhone', title: '联系电话', width: 100 },
                        { field: 'SaleDate', title: '销售日期', width: 100,
                            formatter: function (value) {
                                return JsonToDateString(value, 'yyyy-MM-dd');
                            }
                        }
                    ]],
                pagination: true,
                fitColumns: true,
                toolbar: toolbar
            });
        });      
    </script>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
     <div id="dlg" class="easyui-dialog" closed="true" buttons="#dlg-buttons" 
			style="width:580px;height:450px;padding:5px 5px">
		<div class="ftitle">丧葬物品销售信息</div>
		<form id="fm" method="post">            
			<table width="100%">
                <tr>
                    <td width="80" align="right">编号</td>
                    <td><input id="SaleNO" readonly="readonly" name="SaleNO" class="easyui-validatebox" />
                        <input id="ServiceNo" name="ServiceNo" type="hidden" />
                    </td>
                    <td  width="80" align="right">死者编号</td>
                    <td><input id="DeadNO" name="DeadNO" class="easyui-validatebox" /></td>
                </tr>
                <tr>                    
                    <td  width="80" align="right">顾客姓名</td>
                    <td><input id="CustomerName" name="CustomerName" class="easyui-validatebox" /></td>
                    <td  width="80" align="right">联系电话</td>
                    <td ><input id="ContactPhone" name="ContactPhone" class="easyui-validatebox" /></td>
                    
                </tr>  
                <tr>
                    <td align="right">销售日期</td>
                    <td colspan="3"><input class="easyui-datetimebox" id="SaleDate" name="SaleDate" required="true" style="width:150px"/>                        
                    </td>
                </tr>                                
                <tr>
                    <td colspan="4">
                        <div id="itemList">
                            <%Html.RenderPartial("UCServicesItemList", Model);%>
                        </div>                                           
                    </td>
                </tr>
            </table>             
		</form>                
        <!-- 选择死者列表 -->
        <% Html.RenderPartial("UCSelectDeadNo"); %>
	</div>
</asp:Content>


